package com.hzncc.flowable_diboot.trial_contracts.vo;

import com.diboot.core.binding.annotation.BindDict;
import com.diboot.core.binding.annotation.BindEntityList;
import com.diboot.core.binding.annotation.BindField;
import com.diboot.core.binding.annotation.BindFieldList;
import com.diboot.core.vo.FileVO;
import com.diboot.core.vo.LabelValue;
import com.diboot.file.entity.FileRecord;
import com.diboot.iam.entity.IamOrg;
import com.diboot.iam.entity.IamUser;
import com.hzncc.flowable_diboot.trial_contracts.entity.TrialContractAudit;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.List;
/**
* 试用合同审批单 VO定义
* @author MyName
* @version 1.0
* @date 2024-10-16
* Copyright © MyCorp
*/
@Getter @Setter @Accessors(chain = true)
public class TrialContractAuditListVO extends TrialContractAudit  {
private static final long serialVersionUID = 1889357582997041485L;
    /**
    * 合同类型 关联字典选项
    */
    @BindDict(
    type = "projectContractType",
    field = "contractType"
    )
    private LabelValue contractTypeLabel;

    /**
    * 客户性质 关联字典选项
    */
    @BindDict(
    type = "customerType",
    field = "customerNature"
    )
    private LabelValue customerNatureLabel;

    /**
    * 负责人 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.principal = id"
     )
    private String principalLabel;

    /**
    * 签订部门 关联信息
    */

    @BindField(
        entity = IamOrg.class,
        field = "name",
       condition = "this.principal = dbt_iam_user.id and dbt_iam_user.orgId = id"
     )
    private String dept;

    /**
    * 签订人 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.signer = id"
     )
    private String signerLabel;

    /**
    * 合同附件 关联文件信息
    */
    @BindEntityList(entity = FileRecord.class, condition = "this.attachment = id", splitBy = ",")
    private List<FileVO> attachmentFiles;

    /**
    * 合同状态 关联字典选项
    */
    @BindDict(
    type = "contractStatus",
    field = "contractStatus"
    )
    private LabelValue contractStatusLabel;

    @BindFieldList(
        entity = IamUser.class,
        field = "id",
        condition = "this.id = mdl_trial_contract_audit_iam_user.trial_contract_audit and mdl_trial_contract_audit_iam_user.`user` = id"
    )
    private List<String> starUids;

    /**
    * 关注人 关联信息
    */
    @BindFieldList(
        entity = IamUser.class,
        field = "realname",
        condition = "this.id = mdl_trial_contract_audit_iam_user.trial_contract_audit and mdl_trial_contract_audit_iam_user.`user` = id"
     )
    private List<String> starUidsLabel;

    /**
    * 创建人 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.create_by = id"
     )
    private String createByLabel;

    /**
    * 更新人 关联信息
    */

    @BindField(
        entity = IamUser.class,
        field = "realname",
        condition = "this.update_by = id"
     )
    private String updateByLabel;

    private Boolean isStar;
}